C++中出现"unknown character '0xal' "错误是有哪些可能性?

来源:百度知道 编辑:UC知道 时间:2024/08/22 05:53:13
还是把源码给出来吧:
#include <iostream>
using namespace std;
class shape
{
public:
virtual float TM()const=0;
};

class Circle:public shape //定义圆类
{
public:
Circle(float r):R(r){}
virtual float TM()const{return 3.14*R*R;}
protected:
float R;
};

class Triangle:public shape //定义三角形类
{
public:
Triangle(float w,float h):width(w),height(h){}
virtual float TM()const{return 0.5*width*height;}
protected:
float width,height;
};

class Square:public shape//定义正方形类(就在这行报错如题的错误!)
{
public:
Square(float s):size(s){}
virtual float TM()const{return size*size;}
protected:
float size;
};

class Trapezoid:public shape //定义梯形类
{
public:
Trapezoid(float u,float d,float h):up(u),down(d),height(h){}
virtual float TM()con

class Square:public shape//定义正方形类(就在这行报错如题的错误!):unknown character '0xal'
猜想这一行曾经输入过汉字但是没有删除干净,留下了半个汉字但我们看不出.
建议重新手工键入这一行, 然后删掉或注释掉原来那行.
也许是前面一个空行出现同样问题. 同样方法处理. 一定要手工键入, 不要拷贝.